<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<div class="t_bar">
	项目拟购置、试制设备清单 （单位：万元）
</div>
<table  id="shibei" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead>
				<tr>
					<th width="5%" >选择</th>
	        		<th width="5%" >序号</th>
					<th width="10%">设备名称</th>
					<th width="10%">型号</th>
					<th width="10%">产地</th>
					<th width="10%">数量</th>
					<th width="10%">单价</th>
					<th width="10%">金额</th>
					<th width="10%">用途</th>
					<th width="20%">经费来源</th>
				</tr>
				</thead>
				<tbody id="tab">
				<tr style="display:none">
				<td align="center">
					<input type="radio" class="radiobutton" name="setshibei" >
				</td>
				<td align="center">
					<span name="shibeis|shibei[0]@seq_no">[index]</span>
				</td>
				<td align="center">
					<input name="shibeis|shibei[0]|shibei_name" value="" label="设备名称" class="required input_text" maxlength="100" style="width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis|shibei[0]|shibei_xinghao" value="" label="型号" class="required input_text" maxlength="100" style="width:80%"/> 
				</td>
				<td align="center">
					<input name="shibeis|shibei[0]|shibei_address" value="" label="产地" class="required input_text" maxlength="100" style="width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis|shibei[0]|shibei_num" value="" label="数量" 
					onchange="
					countTable_swj3('shibei','shebei_total_price',5,6,7);
					countTable_swj1('shibei','shebei_total_num',5);
					countTable_swj4('shibei','zcshebei_total_num',5,9);
 					countTable_swj5('shibei','zxshebei_total_num',5,9);
 					countTable_swj7('shibei','zcshebei_total_price',7,9);
		 			countTable_swj6('shibei','zxshebei_total_price',7,9);"
					class="required input_text" onfocus="InitInput.setNumber(this,7,0,0)"  
					style="text-align:right;width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis|shibei[0]|shibei_price" value="" label="单价" 
					onchange="countTable_swj3('shibei','shebei_total_price',5,6,7);
					countTable_swj7('shibei','zcshebei_total_price',7,9);
		 				 countTable_swj6('shibei','zxshebei_total_price',7,9);"
					class="required input_text" onfocus="InitInput.setNumber(this,7,2,2)" style="text-align:right;width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis|shibei[0]|shibei_money" value="" label="金额" disabled
					onchange="countTable_swj2('shibei','shebei_total_price',7);
							  countTable_swj7('shibei','zcshebei_total_price',7,9);
 				 		      countTable_swj6('shibei','zxshebei_total_price',7,9);"
					class="required gray" onfocus="InitInput.setNumber(this,7,2,2)"  style="text-align:right;width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis|shibei[0]|shibei_yongtu" value="" label="用途" class="required input_text" maxlength="100" style="width:80%"/>
				</td>
				<td align="center">
					 <cpt:select id="money_where_[index]" key="money_where" name="money_where"
					 onChange="
		 				initControlValue(this.id);
		 				 countTable_swj4('shibei','zcshebei_total_num',5,9);
		 				 countTable_swj5('shibei','zxshebei_total_num',5,9);
		 				 countTable_swj7('shibei','zcshebei_total_price',7,9);
		 				 countTable_swj6('shibei','zxshebei_total_price',7,9);"></cpt:select>
					<input type="hidden" name="shibeis|shibei[0]|money_where_value"   value="" class="required input_text" label="经费来源"/>
					<input type="hidden" name="shibeis|shibei[0]|money_where_name"  value="" /> 
				</td>
			</tr>
			<c:set value="0" var="index" scope="page"/>
			<x:forEach select="$xmlData/data/shibeis/shibei" var="shibei">
			<c:choose>
			<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
			<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
			</c:choose>
			<tr >
				<td align="center">
					<input type="radio" class="radiobutton" name="setshibei" >
				</td>
				<td align="center">
					<span name="shibeis/shibei[${flag}${index}]@seq_no"><x:out select="$shibei/@seq_no"/></span>
				</td>
				<td align="center">
					<input name="shibeis/shibei[${flag}${index}]/shibei_name" value="<x:out select="$shibei/shibei_name"/>" label="设备名称" class="required input_text" maxlength="100" style="width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis/shibei[${flag}${index}]/shibei_xinghao" value="<x:out select="$shibei/shibei_xinghao"/>" label="型号" class="required input_text" maxlength="100" style="width:80%"/> 
				</td>
				<td align="center">
					<input name="shibeis/shibei[${flag}${index}]/shibei_address" value="<x:out select="$shibei/shibei_address"/>" label="产地" class="required input_text" maxlength="100" style="width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis/shibei[${flag}${index}]/shibei_num" 
					value="<x:out select="$shibei/shibei_num"/>" 
					label="数量" class="required input_text" 
					onfocus="InitInput.setNumber(this,7,0,0)" 
					onchange="
					countTable_swj3('shibei','shebei_total_price',5,6,7);
					countTable_swj1('shibei','shebei_total_num',5);
					countTable_swj4('shibei','zcshebei_total_num',5,9);
 					countTable_swj5('shibei','zxshebei_total_num',5,9);
 					countTable_swj7('shibei','zcshebei_total_price',7,9);
		 			countTable_swj6('shibei','zxshebei_total_price',7,9);" style="text-align:right;width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis/shibei[${flag}${index}]/shibei_price" 
					onchange="countTable_swj3('shibei','shebei_total_price',5,6,7)
					countTable_swj7('shibei','zcshebei_total_price',7,9);
		 			countTable_swj6('shibei','zxshebei_total_price',7,9);"
					value="<x:out select="$shibei/shibei_price"/>" label="单价" 
					class="required input_text" onfocus="InitInput.setNumber(this,7,2,2)" 
					style="text-align:right;width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis/shibei[${flag}${index}]/shibei_money" disabled
					value="<x:out select="$shibei/shibei_money"/>" 
					label="金额" class="required gray" 
					onfocus="InitInput.setNumber(this,7,2,2)" 
					onchange="countTable_swj2('shibei','shebei_total_price',7)
					countTable_swj7('shibei','zcshebei_total_price',7,9);
 				    countTable_swj6('shibei','zxshebei_total_price',7,9);"
					style="text-align:right;width:80%"/>
				</td>
				<td align="center">
					<input name="shibeis/shibei[${flag}${index}]/shibei_yongtu" value="<x:out select="$shibei/shibei_yongtu"/>" label="用途" class="required input_text" maxlength="100" style="width:80%"/>
				</td>
				<td align="center">
					<c:set var="money_where_value"><x:out select="$shibei/money_where_value"/></c:set>
					<cpt:select id="money_where_${index }" key="money_where" name="money_where"  value="${money_where_value }"   
	 				 onChange="
	 				 initControlValue(this.id);
	 				 countTable_swj4('shibei','zcshebei_total_num',5,9);
	 				 countTable_swj5('shibei','zxshebei_total_num',5,9);
	 				 countTable_swj7('shibei','zcshebei_total_price',7,9);
	 				 countTable_swj6('shibei','zxshebei_total_price',7,9);"></cpt:select>
				<input type="hidden" name="shibeis/shibei[${flag}${index}]/money_where_value"  class="required input_text" value="${money_where_value }" label="经费来源"/>
				<input type="hidden" name="shibeis/shibei[${flag}${index}]/money_where_name"  value="<x:out select="$shibei/money_where_name"/>" />
					
				</td>
				
			</tr>
			<c:set value="${index+1}" var="index" scope="page"/>
			</x:forEach>
			</tbody>	
				
	</table>
	<table class="t_css">
		<col width="40%">
		<col width="10%">
		<col width="10%">
		<col width="10%">
		<col width="10%">
		<tr>
			<td  align="left">财政专项资金拟购设备合计:</td>
			<td align="center">
			<input type="text" id="zxshebei_total_num" 
				disabled name="invoices/zxshebei_total_num"  label="财政专项资金拟购设备合计"  
				onfocus="InitInput.setNumber(this,7,0,0)" style="text-align:right;width:80%"  
				class="gray" value="<x:out select="$xmlData/data/invoices/zxshebei_total_num" />"/>
			</td>
			<td align="center">/</td>
			<td align="center">
			<input type="text" id="zxshebei_total_price" 
				disabled name="invoices/zxshebei_total_price"  label="财政专项资金拟购设备合计"  
				onfocus="InitInput.setNumber(this,9,4,4)" style="text-align:right;width:80%"  
				class="gray" value="<x:out select="$xmlData/data/invoices/zxshebei_total_price" />"/>
			</td>
			<td align="center">/</td>
			<td align="center">/</td>
		</tr>
		<tr>
			<td  align="left">自筹资金及其他资金拟购仪器设备合计:</td>
			<td align="center">
			<input type="text" id="zcshebei_total_num" 
				disabled name="invoices/zcshebei_total_num"  label="自筹资金拟购设备合计"  
				onfocus="InitInput.setNumber(this,7,0,0)" style="text-align:right;width:80%"  
				class="gray" value="<x:out select="$xmlData/data/invoices/zcshebei_total_num" />"/>
			</td>
			<td align="center">/</td>
			<td align="center">
			<input type="text" id="zcshebei_total_price" 
				disabled name="invoices/zcshebei_total_price"  label="自筹资金拟购设备合计"  
				onfocus="InitInput.setNumber(this,9,4,4)" style="text-align:right;width:80%"  
				class=" gray" value="<x:out select="$xmlData/data/invoices/zcshebei_total_price" />"/>
			</td>
			<td align="center">/</td>
			<td align="center">/</td>
		</tr>
		<tr>
			<td  align="left">设备费用总计:</td>
			<td align="center" >
				<input type="text" id="shebei_total_num" 
				disabled name="invoices/shebei_total_num"  label="设备费用总计"  
				onfocus="InitInput.setNumber(this,7,0,0)" style="text-align:right;width:80%"  
				class=" gray" value="<x:out select="$xmlData/data/invoices/shebei_total_num" />"/>
				
			</td>
			<td align="center">/</td>
			<td align="center">
			<input type="text" id="shebei_total_price" 
				disabled name="invoices/shebei_total_price"  label="设备费用总计"  
				onfocus="InitInput.setNumber(this,9,4,4)" style="text-align:right;width:80%"  
				class=" gray" value="<x:out select="$xmlData/data/invoices/shebei_total_price" />"/>
			</td>
			<td align="center">/</td>
			<td align="center">/</td>
		</tr>
	</table>
	<br/>
<table width="98%" align="center"  border="0" cellpadding="0" cellspacing="1">
		<tr >
			<input class="button_02" type="button" name="cmdAddbefore" value="添加" onclick="addNewRow('shibei');showDateTag('shibei');try{top.resizeFrame();}catch(e){};countTable_swj1('shibei','shebei_total_num',5);countTable_swj2('shibei','shebei_total_price',7);countTable_swj3('shibei','shebei_total_price',5,6,7);counttrnum('shibei','shibei_num')">
			&nbsp;<input class="button_02"   name="cmdMovePrev" type="button" value="上移" onclick="movePrev('shibei','setshibei');">
			&nbsp;<input class="button_02"   name="cmdMoveNext"  type="button" value="下移" onclick="moveNext('shibei','setshibei');">
			&nbsp;<input class="button_02"  name="cmddel" type="button" value="删除" 
			onclick="deleteSelectedRow('shibei','项目拟购置、试制设备清单');
							countTable_swj1('shibei','shebei_total_num',5);
							countTable_swj2('shibei','shebei_total_price',7);
							countTable_swj3('shibei','shebei_total_price',5,6,7);
							counttrnum('shibei','shibei_num')
							initControlValue(this.id);
			 				 countTable_swj4('shibei','zcshebei_total_num',5,9);
			 				 countTable_swj5('shibei','zxshebei_total_num',5,9);
			 				 countTable_swj7('shibei','zcshebei_total_price',7,9);
			 				 countTable_swj6('shibei','zxshebei_total_price',7,9);"></td>
			<input type="hidden" name="proposal/shibei_num" id="shibei_num" value="<x:out select="$xmlData/data/proposal/shibei_num" />" /> 
		</tr>
	</table> 
	<br/>
<p>备注：无仪器设备购置的，不需填写此表。</p>
<br/>

<script type="text/javascript">

function countTable_swj1(tabId,objId,col1){
	 var count =0;
	   $("#"+tabId+" tr:gt(1)").each(function(){
		   var fund1 = $(this).children().eq(col1).children().val();
			  if (!$.isNumeric(fund1)){
					fund1 = "0";
			  }
			 count = ((parseFloat(count)*10000 + parseFloat(fund1)*10000)/10000);
	   });
	   count = formatNumberAuto(count.toString(), 7, 0, 0);
	   
	   $("#" + objId).val(count); 
}
function countTable_swj2(tabId,objId,col1){
	 var count =0;
	   $("#"+tabId+" tr:gt(1)").each(function(){
		   var fund1 = $(this).children().eq(col1).children().val();
			  if (!$.isNumeric(fund1)){
					fund1 = "0";
			  }
			 count = ((parseFloat(count)*10000 + parseFloat(fund1)*10000)/10000).toFixed(4);
	   });
	   count = formatNumberAuto(count.toString(), 9, 2, 2);
	   
	   $("#" + objId).val(count); 
} 
function countTable_swj3(tabId,objId,col1,col2,col3){
	 var count =0;
	 var count2 =0;
	   $("#"+tabId+" tr:gt(1)").each(function(){
		   var fund1 = $(this).children().eq(col1).children().val();
		   var fund2 = $(this).children().eq(col2).children().val();
			  if (!$.isNumeric(fund1)){
					fund1 = "0";
			  }
			  if (!$.isNumeric(fund2)){
					fund2 = "0";
			  }
			 count = (((parseFloat(fund2)*10000) /10000)* ((parseFloat(fund1)*10000)/10000)).toFixed(4);
			 count2 = ((parseFloat(count2)*10000 + parseFloat(count)*10000)/10000).toFixed(4);
			 count = formatNumberAuto(count.toString(), 9, 2, 2);
			 count2 = formatNumberAuto(count2.toString(), 9, 2, 2);
			 $(this).children().eq(col3).children().val(count);
	   });
	   $("#" + objId).val(count2); 
} 
function countTable_swj4(tabId,objId,col1,col4){
	 var count =0;
	   $("#"+tabId+" tr:gt(1)").each(function(){
		   var fund1 = $(this).children().eq(col1).children().val();
		   var money_val = $(this).children().eq(col4).children().val();
		  	 if (!$.isNumeric(fund1)){
					fund1 = "0";
			  }
		  	if (money_val=='02' || money_val=='03'){
				count = ((parseFloat(fund1)*10000 + parseFloat(count)*10000)/10000);
			  } 
	   });
	   count = formatNumberAuto(count.toString(), 7, 0, 0);
	$("#" + objId).val(count); 
} 
function countTable_swj5(tabId,objId,col1,col4){
	 var count =0;
	   $("#"+tabId+" tr:gt(1)").each(function(){
		   var fund1 = $(this).children().eq(col1).children().val();
		   var money_val = $(this).children().eq(col4).children().val();
		  	 if (!$.isNumeric(fund1)){
					fund1 = "0";
			  }
		  	if (money_val=='01'){
				count = ((parseFloat(fund1)*10000 + parseFloat(count)*10000)/10000);
			  } 
	   });
	   count = formatNumberAuto(count.toString(), 7, 0, 0);
	$("#" + objId).val(count); 
} 
function countTable_swj6(tabId,objId,col1,col4){
	 var count =0;
	   $("#"+tabId+" tr:gt(1)").each(function(){
		   var fund1 = $(this).children().eq(col1).children().val();
		   var money_val = $(this).children().eq(col4).children().val();
		  	 if (!$.isNumeric(fund1)){
					fund1 = "0";
			  }
		  	if (money_val=='01'){
				count = ((parseFloat(fund1)*10000 + parseFloat(count)*10000)/10000).toFixed(4);
			  } 
	   });
	   count = formatNumberAuto(count.toString(), 9, 2, 2);
	$("#" + objId).val(count); 
} 
function countTable_swj7(tabId,objId,col1,col4){
	 var count =0;
	   $("#"+tabId+" tr:gt(1)").each(function(){
		   var fund1 = $(this).children().eq(col1).children().val();
		   var money_val = $(this).children().eq(col4).children().val();
		  	 if (!$.isNumeric(fund1)){
					fund1 = "0";
			  }
		  	if (money_val=='02'  || money_val=='03' ){
				count = ((parseFloat(fund1)*10000 + parseFloat(count)*10000)/10000).toFixed(4);
			  } 
	   });
	   count = formatNumberAuto(count.toString(), 9, 2, 2);
	$("#" + objId).val(count); 
}


function counttrnum(tblId,vlaueId){
	var maxLinNum=$("#"+tblId+" tr").length-2;
	$("#"+vlaueId).val(maxLinNum);
}
</script>
